package org.snail.base;

import lombok.Data;
import lombok.NonNull;
import lombok.ToString;
import lombok.extern.log4j.Log4j;
import org.snail.attendence.bean.AliWorkDTO;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 封装了异常考勤，多条件查询的属性
 */
@Data
@ToString
@Log4j
public class AttendenceCondition {
    //员工id
    private Integer empId;
    //微信请假小时
    private String realHour;
    //异常考勤数据（从mongoDB中查询）sss
    private Date startDate;   //查询开始日期
    private Date endDate;     //查询结束日期
    private Date date;         //考勤日期
    private String orders;      //班次
    private Integer groupId;     //钉钉群组id
    private Integer latestFlag;    //查看是不是最新的数据
    private int isCorrect;      //是否标记
    private List<Integer> groupIds;          //群组名称

//    ==================================华丽丽的分割线======================================

    private List<String> groupNames;          //群组名称

    private String groupName;          //群组名称(一个)
    private String dateStr;        //日期查询   默认格式为18-03
    private Date attendanceDate;        //日期查询   默认格式为18-03
    private AliWorkDTO aliWorkDTO;      //考勤中的全部数据
    private String fastInquiry;      //快速查询字段
    private List<AliWorkDTO> aliWorkDTOList;
    private int attId;    //考勤表主表ID(AttendenceCommonDO)
    private int approvalType;
    private String aliNumber;
    private String employeeName;     //员工姓名
    private String punchComment1;       //
    private String punchComment2;
    private String punchComment3;
    private String approval;   //审批单


    public Date getAttendanceDate() {
        return attendanceDate;
    }

    public void setAttendanceDate(@NonNull String dateStr) {
        //dateStr 18-05-12 星期六，转换成date类型
        String datePattern = dateStr;
        if(dateStr!=null&&dateStr.contains(" ")){
            String dateDemo = dateStr.split(" ")[0];         // 将18-05-12取出
            datePattern = "20" + dateDemo;
        }
                  //虽然有些简单粗暴，但是还是将代码强行转为2018-05-12
        SimpleDateFormat strToDate = new SimpleDateFormat("yyyy-MM-dd");


        this.attendanceDate = null;
        try {
            attendanceDate = strToDate.parse(datePattern);
        } catch (ParseException e) {
            log.error("=======转换类型操作异常", e);
            log.error("=======转换类型操作异常", e);
        }
    }





    public static void main(String[] args) throws Exception {
        List<String> list1 = new ArrayList<String>();
        list1.add("a");
        list1.add("b");
        list1.add("c");
        list1.add("d");
        list1.add("e");
        List<String> list2 = new ArrayList<String>();
        list2.add("d");
        list2.add("e");
        list2.add("f");
        list2.add("g");
        list2.add("h");
        System.out.println(list1);
        System.out.println(list2);
        List<String> lista = new ArrayList<String>(list1);//构建list1的副本
        lista.removeAll(list2);// 去除相同元素
        List<String> listb = new ArrayList<String>(list2);//构建list2的副本
        listb.removeAll(list1);// 去除相同元素
        System.out.println(lista);
        System.out.println(listb);
    }



}
